#include "uart.c"
#include "timer.c"
#include <regx52.h>

sbit BTN_RAND = P2 ^ 1;
sbit BTN_SEED = P2 ^ 2;
sbit BTN_THTL = P2 ^ 3;

void main()
{
    uart_init();
    timer0_init();
    timer0_isr_on();
    while (1)
    {
        if (BTN_RAND == 0)
        {
            while (BTN_RAND == 0)
            {
            }
            printf("RAND=%u\n", timer_rand());
            printf("game seed=%u\n", timer_seed);
        }

        if (BTN_SEED == 0)
        {
            while (BTN_SEED == 0)
            {
            }
            printf("game seed=%u\n", timer_seed);
        }
        if (BTN_THTL == 0)
        {
            while (BTN_THTL == 0)
            {
            }
            printf("TH0TL0=0x%04x\n", get_timer0_value());
        }
    }
}
